package net.lzzy.spark;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

import java.util.List;

public class SparkCollect {
    public static void main(String[] args) {
        SparkConf conf = new SparkConf().setAppName("SparkTextFile").setMaster("local");
        JavaSparkContext javaSparkContext = new JavaSparkContext(conf);
        JavaRDD<String> javaRDD = javaSparkContext.textFile("D:\\Spark\\trip.csv");
        List<String> res = javaRDD.collect();
        for (String re : res) {
            System.out.println(re);
        }
    }
}
